#ifndef ERFRES_CPP
#define ERFRES_CPP

// Tables of error function residues
static double erfres30[64] = { // epsilon = 3.0
0.9973002039367397991, 0.9707091134651117709, 0.8909358420502276756, 0.7473439535034362844, 
0.5627258110861330418, 0.378107668668829774, 0.227056461236490716, 0.1224825483987175077, 
0.05973820069605357421, 0.02652060485346678132, 0.01078595419118882464, 0.004042532478783985144, 
0.001403802243495134545, 0.0004538593587911481996, 0.0001372117305564860409, 3.894177696641846101E-05, 
1.0411790440269804887E-05, 2.630885024047443064E-06, 6.300807741616926066E-07, 1.433986593246181042E-07, 
3.108740205452397302E-08, 6.433711434259404257E-09, 1.273636653273796135E-09, 2.416216970766743697E-10, 
4.400181184743825996E-11, 7.704281907374479739E-12, 1.29883544736322353E-12, 2.111181239650855349E-13, 
3.312801649993565668E-14, 5.024315321227777333E-15, 7.373100566791171862E-16, 1.048010832211180614E-16, 
1.444265844140388838E-17, 1.931491933443462709E-18, 2.508874771502709714E-19, 3.167820024246332353E-20, 
3.891108803445448874E-21, 4.653030095939296124E-22, 5.420631433174724478E-23, 6.156051249154493931E-24, 
6.819706448084835934E-25, 7.373946654781569476E-26, 7.786688182201094321E-27, 8.034528258419003796E-28, 
8.104916828750090749E-29, 7.997113029190838538E-30, 7.721844871601713898E-31, 7.299785406042931216E-32, 
6.759120398348474674E-33, 6.132585121760249945E-34, 5.454379525125676544E-35, 4.757335327267510508E-36, 
4.07062130025730356E-37, 3.418157026214914898E-38, 2.8177848614740899E-39, 2.281145072899103552E-40, 
1.814123532903090401E-41, 1.417700394093600301E-42, 1.08902007881115484E-43, 8.225208941693561182E-45, 
6.10997257199465139E-46, 4.465093355940833106E-47, 3.210958658916363842E-48, 2.272804660809417948E-49};
static double erfres40[64] = { // epsilon = 4.0
0.9999366575163337468, 0.9988660157102146651, 0.9931559260775795618, 0.9748836392531472292, 
0.9331184122258733201, 0.8588691197329419162, 0.7508701488341325862, 0.61794833849713647, 
0.4761650741376739266, 0.3427220017993562206, 0.2303488882512991895, 0.1447312779289700113, 
0.08517120118300187921, 0.04705275206558226943, 0.02446404147748175685, 0.0120013046012883689, 
0.005568924278091780692, 0.002450194424420707192, 0.001024489348456787683, 0.0004079682345264440278, 
0.0001550364954780978781, 5.6331426581182294E-05, 1.960395908465556002E-05, 6.545303974779386148E-06, 
2.0998043629066455E-06, 6.482126529073830492E-07, 1.928113321233006492E-07, 5.53316881130116041E-08, 
1.53376098554729673E-08, 4.111201923532295796E-09, 1.06675231487041836E-09, 2.682081552214012181E-10, 
6.540328927879366231E-11, 1.548209150830564176E-11, 3.560611443711485972E-12, 7.962102693128407714E-13, 
1.732466243779347261E-13, 3.670664740590050565E-14, 7.57811898519986798E-15, 1.52543775492440997E-15, 
2.995782652483676744E-16, 5.743318086791484224E-17, 1.075461038493597664E-17, 1.968055941081130149E-18, 
3.521378824411581595E-19, 6.16357595395901216E-20, 1.0558463205248481584E-20, 1.770971362781101455E-21, 
2.909727366813319685E-22, 4.684925196384418466E-23, 7.394951403442113193E-24, 1.144765176051685175E-24, 
1.738624611172496222E-25, 2.591538074628799382E-26, 3.792452840349803386E-27, 5.450505789276832448E-28, 
7.695655926323343081E-29, 1.067776001870955428E-29, 1.456361862949709337E-30, 1.953159613073372052E-31, 
2.576357117054765171E-32, 3.343420408658120908E-33, 4.269780331277750396E-34, 5.367340905989071734E-35};
static double erfres50[64] = { // epsilon = 5.0
0.9999994266968562282, 0.9999845595017088853, 0.9998606662088143606, 0.9992411997443417374, 
0.9970288195140823685, 0.9908833188744730099, 0.97691627196626992, 0.9500565663735716664, 
0.9052903903857412378, 0.839457778638931775, 0.7528359210773403646, 0.6497146620754458144, 
0.5376263370733865053, 0.4255380120713271809, 0.3217525259583092738, 0.2322822793091558934, 
0.1601288545920967057, 0.1054671692003851925, 0.06642310820630553481, 0.04004198591300846522, 
0.02313101008397187982, 0.01281943945651054586, 0.006824340254498141571, 0.003493729586713472069, 
0.001722128167679073154, 0.0008182498926615225644, 0.0003751723068686055482, 0.0001661734456455314553, 
7.117396327140685464E-05, 2.950752363363290127E-05, 1.185225260067783387E-05, 4.616485783892969192E-06, 
1.745149745486276468E-06, 6.407897307144714238E-07, 2.287150983369321715E-07, 7.941269530159184236E-08, 
2.684142662717622631E-08, 8.837567492102382728E-09, 2.83628111374443405E-09, 8.878115103814634345E-10, 
2.71207205519763788E-10, 8.089723488343671051E-11, 2.35749545712899926E-11, 6.715460361835073274E-12, 
1.870778117738831423E-12, 5.09912318835392515E-13, 1.360480883674147421E-13, 3.554695114484005818E-14, 
9.099283454688821946E-15, 2.282874256196234359E-15, 5.615588020314392778E-16, 1.354906203074800412E-16, 
3.207601309292681429E-17, 7.453487565652233086E-18, 1.700561040588077812E-18, 3.810824797935466062E-19, 
8.390262375874223986E-20, 1.815486799882976042E-20, 3.861877616240089026E-21, 8.07819842182466518E-22, 
1.662110661199406928E-22, 3.364726941280723974E-23, 6.703408293471168356E-24, 1.314636069603953344E-24};
static double erfres60[64] = { // epsilon = 6.0
0.999999998026824696, 0.9999999251162304981, 0.9999990501891001235, 0.9999927507137614268, 
0.9999603534120195576, 0.9998307642050520812, 0.9994066540731585219, 0.9982321952463763577, 
0.995413494062099163, 0.9894444797895121618, 0.9781347685361894209, 0.9587466921019218624, 
0.9284001376830682885, 0.8847010993199191362, 0.8264357148357202586, 0.754106272027749228, 
0.6701107900572022133, 0.578479355180241821, 0.4842298793067968336, 0.3925276865650665628, 
0.3078795086496232243, 0.2335542792604534534, 0.1713285058183578228, 0.1215478870646813115, 
0.08341805142356738273, 0.05540429462601428844, 0.03562987806303563091, 0.02219819888818220131, 
0.0134065543373690462, 0.007853936726329157996, 0.004465898861965835917, 0.002466401105948137368, 
0.00132383095965230947, 0.0006910228786269277778, 0.0003510065962849315982, 0.0001736067968021509586, 
8.365760269820583323E-05, 3.929909601680823111E-05, 1.800701280973737917E-05, 8.052272609028927557E-06, 
3.5159353023769743E-06, 1.499785388309439244E-06, 6.25310726786170908E-07, 2.549449877880807382E-07, 
1.0169019923714685393E-07, 3.969949825025224054E-08, 1.517570445323898357E-08, 5.68262298342739892E-09, 
2.085244742235640035E-09, 7.501352918964303688E-10, 2.646409463185358785E-10, 9.159345680562296727E-11, 
3.111083911178932009E-11, 1.0373941616760638222E-11, 3.39704152497528636E-12, 1.092744246954435888E-12, 
3.454045892179437415E-13, 1.073140787886187772E-13, 3.278139726291703902E-14, 9.848264485778039538E-15, 
2.910510032189769833E-15, 8.463847402130942674E-16, 2.422505084150427996E-16, 6.82598496572039531E-17};
static double erfres70[64] = { // epsilon = 7.0
0.9999999999974403612, 0.9999999998695542755, 0.9999999977807482088, 0.999999977310448755, 
0.9999998340183525784, 0.9999990538724956176, 0.9999955786773146099, 0.9999824798647092735, 
0.9999396904101985078, 0.9998163561001380655, 0.9994982834057716613, 0.9987561137855833849, 
0.9971749698121387959, 0.994075927624187401, 0.9884517399497570911, 0.9789488021550300142, 
0.9639280295117517295, 0.9416244580111263947, 0.9103994579102509214, 0.869047430749632046, 
0.8170923197016749901, 0.75499962601021411, 0.6842428355245958881, 0.607196552551367147, 
0.5268717043452350444, 0.4465468561391029307, 0.3693720019802701052, 0.2980216651164435208, 
0.2344550013650343733, 0.179809974631366853, 0.1344268168356090757, 0.09797149336032823326, 
0.06961735287955424081, 0.04824269313250922818, 0.03261047928765541084, 0.0215093419195708144, 
0.0138479935951180637, 0.008705444719800463212, 0.005345646121259630434, 0.003207592467642736553, 
0.001881457922994283206, 0.001079228383639045887, 0.0006056229929353515009, 0.0003326034147649864646, 
0.0001788337672897233772, 9.417407373592683438E-05, 4.858808489926715121E-05, 2.45696606735002181E-05, 
1.218121028336779827E-05, 5.923127096599874E-06, 2.825691983957163582E-06, 1.322975939209709808E-06, 
6.0809160724247442E-07, 2.7447891899109786E-07, 1.217030150255141806E-07, 5.302393893089398514E-08, 
2.27061485828183992E-08, 9.559496130998010578E-09, 3.957878999352800748E-09, 1.611902593791986054E-09, 
6.459123091492975179E-10, 2.547261608229194624E-10, 9.888777653029728883E-11, 3.779912988758938846E-11};
static double erfres80[64] = {
0.9999999999999987423, 0.999999999999917906, 0.9999999999981933974, 0.9999999999761196883, 
0.9999999997743029186, 0.9999999983391614454, 0.9999999899892474197, 0.9999999488819783701, 
0.9999997734909637582, 0.9999991131953793371, 0.9999968890418318132, 0.9999901106691155501, 
0.9999712491102529049, 0.9999229635195645331, 0.9998085087860809852, 0.9995559190294276381, 
0.9990344434027884699, 0.9980230967329428102, 0.9961737771080821751, 0.992974953973188103, 
0.9877256031877209071, 0.9795314946445526003, 0.9673356121616974442, 0.9499903570749701087, 
0.9263712863185754359, 0.895521887779610961, 0.8568089170640476932, 0.8100611788414807219, 
0.7556638107279482388, 0.6945860640741573722, 0.6283322371954689654, 0.5588200253883204634, 
0.4882044451397886425, 0.4186752584335419168, 0.352259318893246528, 0.2906561285950015214, 
0.2351264922698229162, 0.1864429754915841324, 0.1448997078408203646, 0.1103702386246011242, 
0.08239699774057540662, 0.06029468395566619472, 0.04325193597694101692, 0.03041974926354794013, 
0.02097997972725877889, 0.01419183084723061707, 0.009417748118419601518, 0.006132357853431375311, 
0.003919042306491938404, 0.002458710399232928287, 0.001514657449085689294, 0.000916445678695359554, 
0.0005447412776761254898, 0.0003181785951501161244, 0.0001826644672840918124, 0.00010309653899578394872, 
5.721953529802084985E-05, 3.123609957539395844E-05, 1.677575273845377342E-05, 8.865819425939483094E-06, 
4.611737644419191918E-06, 2.361644801301021071E-06, 1.190864785369614942E-06, 5.914254172127349216E-07};
static double erfres90[64] = {
0.9999999999999999859, 0.9999999999999999673, 0.9999999999999994678, 0.9999999999999913743, 
0.9999999999998977213, 0.999999999999054844, 0.9999999999928482027, 0.9999999999541760523, 
0.9999999997453464405, 0.9999999987503347613, 0.9999999945084428652, 0.9999999781468598379, 
0.9999999205256326544, 0.9999997338328565798, 0.9999991737545283562, 0.9999976093978184901, 
0.9999935218851249691, 0.9999834888994226904, 0.9999602697039402739, 0.9999094384922084972, 
0.9998038659755348071, 0.9995952958816184925, 0.9992024080302877603, 0.9984952098978924422, 
0.997276421627168596, 0.9952616899959720335, 0.9920618221111304338, 0.9871714579852404415, 
0.9799692853634751789, 0.9697346190062298042, 0.9556836363801810677, 0.9370257742046081526, 
0.91303709426458583, 0.8831435084931733932, 0.847003501814301636, 0.8045782765825826114, 
0.756177667515410196, 0.7024728821121092894, 0.6444717138765443024, 0.5834574979404304766, 
0.520898618309731482, 0.4583397386790324788, 0.3972883019310009132, 0.3391098739711120015, 
0.2849437513877671454, 0.2356464937557341796, 0.191766517182166369, 0.153548473069704077, 
0.120962561773815171, 0.0937516461555986582, 0.07148816974069423556, 0.05363330251685999316, 
0.03959209625345636374, 0.02876030856454499099, 0.02056054405237843667, 0.01446714106627301473, 
0.010020603752087976488, 0.006833262845459762803, 0.004588266206878151117, 0.003034037764783188969, 
0.001976117564701744, 0.001267923050597636114, 0.0008015510535046869552, 0.0004993419993884558586};

#endif